import AreaMeasurement2DViewModel from "@geoscene/core/widgets/AreaMeasurement2D/AreaMeasurement2DViewModel.js";
import DistanceMeasurement2DViewModel from "@geoscene/core/widgets/DistanceMeasurement2D/DistanceMeasurement2DViewModel.js";
import AreaMeasurement3DViewModel from "@geoscene/core/widgets/AreaMeasurement3D/AreaMeasurement3DViewModel.js";
import DirectLineMeasurement3DViewModel from "@geoscene/core/widgets/DirectLineMeasurement3D/DirectLineMeasurement3DViewModel.js";

export function measureArea(view: any): any { 
    
    let viewModel: any;
    if (view.type === "2d") {
        viewModel = new AreaMeasurement2DViewModel({ view });
    } else if (view.type === "3d") {
        viewModel = new AreaMeasurement3DViewModel({ view });
    }
    return viewModel;
}

export function measureDistance(view: any): any {
    
    let viewModel: any;
    if (view.type === "2d") {
        viewModel = new DistanceMeasurement2DViewModel({ view });
    } else if (view.type === "3d") {
        viewModel = new DirectLineMeasurement3DViewModel({});
    }
    return viewModel;
}